package UserUI;

import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import vo.StudentVO;
import RMI.RMIHelper;
import UserBL.UserLogicService;

public class StudentUI extends JPanel
{
	private StudentSearch ss=new StudentSearch();
	private StudentInfo si=new StudentInfo(new StudentVO());
	private RMIHelper rmi;
	private UserLogicService uls;
	
	
	
	public StudentUI(){
		this.setBounds(0, 0, 1280, 725);
		this.setLayout(null);
		this.setVisible(true);

		ss.setLocation(0, 0);
		si.setLocation(512, 0);
		this.add(ss);
		this.add(si);
		rmi=new RMIHelper();
		uls=rmi.getUserService();
		setOpaque(false);
		ss.table.addMouseListener(new ClickListener());
		ss.table.repaint();
		this.setOpaque(false);
		this.repaint();
	}
	public static void main(String[] args){
		JFrame jf=new JFrame();
		jf.getContentPane().setLayout(null);
		jf.setBounds(0, 0,1280, 725);
		jf.setVisible(true);
		StudentUI su=new StudentUI();
		su.setVisible(true);
		jf.getContentPane().add(su);
		
		jf.repaint();
	}

	private class ClickListener implements MouseListener {

		public void mouseClicked(MouseEvent e) {
			int row = ss.table.getSelectedRow();
			StudentVO student = new StudentVO();
			student = ss.svList.get(row);
			si.showStudent(student);
			si.repaint();
		}

		@Override
		public void mouseEntered(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mouseExited(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mousePressed(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mouseReleased(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}
		
	}
}
